<?php
error_reporting(0);
$isadmin=1;
include '../../comm/config.php';
include '../../comm/checkpostandget.php';
include '../check.php';
$id=$_POST['id']; 
$typecode=$_POST['typecode']; 
$link = mysql_connect($dbserver, $dbuser, $dbpass);
if (!$link) {
     die(ERR_DB);
}
mysql_select_db($dbname);
mysql_query("set names utf8");
$sql="select * from ".$BIAOTOU."mall where catid='".$typecode."'";
$rs = mysql_query($sql);
$num=mysql_num_rows($rs);
if($num!=0){
	echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" /><script language=javascript>alert('删除失败，该类别下的商城不为空！');window.location='mall_type_del.php?id=".$id."';</script>";
}else{
	$q = "delete from ".$BIAOTOU."malltype  where id='".$id."'";
	mysql_query($q);
	echo "<script language=javascript>window.location='mall_type.php';</script>";
}
mysql_close($link);
?>